
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
import org.springframework.beans.factory.BeanFactory;
import org.springframework.context.ConfigurableApplicationContext;
import org.springframework.context.support.FileSystemXmlApplicationContext;
import com.generalynx.ecos.data.dao.IBasicDAO;
import com.alesj.newsfeed.data.Contact;

/**
 * User: alesj
 * Date: 2004.8.13
 * Time: 10:58:32
 */

public class Test {

    private static final Log logger = LogFactory.getLog(Test.class);

    public static void main(String[] args) {
        BeanFactory beanFactory = null;
        try {
            beanFactory = getBeanFactory();

            IBasicDAO basicDAO = (IBasicDAO)beanFactory.getBean(IBasicDAO.basicDAO);
            Contact contact = (Contact)basicDAO.getEntity(Contact.class, 4);
            System.out.println(contact.getStatus());

        } catch (Exception e) {
            e.printStackTrace();
        } finally {
            if (beanFactory != null) {
                ((ConfigurableApplicationContext)beanFactory).close();
            }
        }
        System.out.println("-- end --");
    }

    private static BeanFactory getBeanFactory() {
        return new FileSystemXmlApplicationContext(new String[]{
            "\\projects\\newsfeed\\webroot\\WEB-INF\\applicationContext.xml",
        });
    }

}
